<?php
/**
 * Classe commune aux services SOAP / REST
 *
 * @package zfbook
 * @subpackage reservation
 */
abstract class Zfbook_Reservation_Server
{
    /**
     * Get a list of reservation ids
     * 
     * @param string $dateBegin
     * @param string $dateEnd
     * @return array
     */
    public function getReservations($dateBegin, $dateEnd)
    {
        $reservations = new TReservation();
        return $reservations->getRestrictedList($dateBegin, $dateEnd);
    }

    /**
     * Get a reservation detail
     * 
     * @param integer $id
     * @return array
     */
    public function getDetail($id)
    {
        $reservations = new TReservationList();
        return $reservations->find((int)$id)->current()->toArray();
    }

    /**
     * Get the entire list of rooms
     * 
     * @return array
     */
    public function getRooms()
    {
        $rooms = new TRoom();
        return $rooms->fetchAll()->toArray();
    }

    /**
     * Add a reservation
     * 
     * @param integer $userId
     * @param string $password
     * @param integer $roomId
     * @param string $usage
     * @param string $dateBegin
     * @param string $dateEnd
     * @return integer new reservation ID
     */
    public function add($userId, $password, $roomId, $usage, $dateBegin, $dateEnd)
    {
        return 'not implemented';
    }

    /**
     * Delete a reservation
     * 
     * @param integer $roomId
     * @param $userId
     * @param string $dateBegin
     * @return boolean
     */
    public function delete($roomId, $userId, $dateBegin)
    {
        return 'not implemented';
    }
}
